<page-header [autoTitle]="false"></page-header>
<nz-card>
  <section class="search-section">
    <input nz-input placeholder="姓名" [(ngModel)]="keyword" class="search-item"/>
    <nz-select [(ngModel)]="salesmanId" [nzPlaceHolder]="'所属星创股东'" class="search-item" [nzAllowClear]="true" [nzShowSearch]="true">
      <nz-option
        *ngFor="let option of allSalesmans"
        [nzLabel]="option.name"
        [nzValue]="option.id">
      </nz-option>
    </nz-select>
    <nz-select [(ngModel)]="districtId" [nzPlaceHolder]="'所属运营中心'" class="search-item" [nzAllowClear]="true">
      <nz-option
        *ngFor="let option of allDistricts"
        [nzLabel]="option.name"
        [nzValue]="option.id">
      </nz-option>
    </nz-select>
    <nz-select [(ngModel)]="marketLevelId" [nzPlaceHolder]="'加盟类别'" class="search-item" [nzAllowClear]="true">
      <nz-option
        *ngFor="let option of allMarketAgentLevels"
        [nzLabel]="option.name"
        [nzValue]="option.id">
      </nz-option>
    </nz-select>
    <button nz-button [nzType]="'primary'" nzGhost (click)="search()"  class="search-item">
      <i class="anticon anticon-search"></i><span>搜索</span>
    </button>
  </section>
  <nz-table #nzTable [nzData]="page.content"
            [nzPageSize]="page.size"
            [nzTotal]="page.totalElements"
            [nzFrontPagination]="false"
            [(nzPageIndex)]="page.number"
            (nzPageIndexChange)="changePageNo($event)"
            [nzLoading]="isLoading">
    <thead>
    <tr>
      <th nz-th><span>序号</span></th>
      <th nz-th><span>姓名</span></th>
      <th nz-th><span>微信昵称</span></th>
      <th nz-th><span>手机号</span></th>
      <th nz-th><span>所属星创股东</span></th>
      <th nz-th><span>所属营运中心</span></th>
      <th nz-th><span>加盟类别</span></th>
      <th nz-th><span>送车标题</span></th>
      <th nz-th><span>提交时间</span></th>
      <th nz-th><span>操作</span></th>
    </tr>
    </thead>
    <tbody>
    <tr *ngFor="let data of nzTable.data;let i=index">
      <td>
        {{i+1}}
      </td>
      <td title="点击查看推广链" (click)="seeLink(data)"><a href="javascript:void (0);">{{data.name}}</a></td>
      <td>{{data.nickname}}</td>
      <td>{{data.phone}}</td>
      <td>{{data.salesmanId|dicsNamePipe:allSalesmans:'id':'name'}}</td>
      <td>{{data.districtId|dicsNamePipe:allDistricts:'id':'name'}}</td>
      <td>{{data.marketLevelId|dicsNamePipe:allMarketAgentLevels:'id':'name'}}</td>
      <td [title]="data.title">{{data.title|stringEllipsisCutPipe:36}}</td>
      <td>{{data.saveDate}}</td>
      <td>
        <nz-popconfirm [nzTitle]="'确定签约该用户成为渠道？'" (nzOnConfirm)="signed(data)">
          <a nz-popconfirm *ngIf="data.salesmanId">签约</a>
        </nz-popconfirm>
        <span *ngIf="!data.salesmanId">
          <a href="javascript:void (0);" (click)="setSalesMan(data)">配置星创股东</a>
        </span>
      </td>
    </tr>
    </tbody>
  </nz-table>
</nz-card>
